package kr.hkit.androidcomplete01.ch07;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.os.Bundle;
import android.view.View;

public class PaintStyle extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MyView vw = new MyView(this);
		setContentView(vw);
	}
	
	class MyView extends View{

		public MyView(Context context) {
			super(context);
		}
		
		public void onDraw(Canvas canvas){
			canvas.drawColor(Color.LTGRAY);
			Paint pnt = new Paint(Paint.ANTI_ALIAS_FLAG);
			
			pnt.setStrokeWidth(8);
			pnt.setColor(Color.RED);
			//채우기
			pnt.setStyle(Paint.Style.FILL);
			canvas.drawCircle(50, 50, 40, pnt);
			//외곽선 그리기
			pnt.setStyle(Style.STROKE);
			canvas.drawCircle(150, 50, 40, pnt);
			//외곽선 및 채우기
			pnt.setStyle(Style.FILL_AND_STROKE);
			canvas.drawCircle(250, 50, 40, pnt);
			//파란색으로 채우고 빨간색으로 외곽선 그리기
			pnt.setColor(Color.BLUE);
			pnt.setStyle(Style.FILL); //(Paint.Style.FILL)
			canvas.drawCircle(50, 150, 40, pnt);
			pnt.setColor(Color.RED);
			pnt.setStyle(Paint.Style.STROKE);
			canvas.drawCircle(50, 150, 40, pnt);
			//빨간색으로 외곽선 그리고 파란색으로 채우기
			pnt.setColor(Color.RED);
			pnt.setStyle(Paint.Style.STROKE);
			canvas.drawCircle(150, 150, 40, pnt);
			pnt.setColor(Color.BLUE);
			pnt.setStyle(Paint.Style.FILL);
			canvas.drawCircle(150, 150, 40, pnt);
			
		}
		
	}
}
